package com.gjzhao.fmmall.service.impl;

import com.gjzhao.fmmall.entity.Orders;
import com.gjzhao.fmmall.service.OrderService;
import com.gjzhao.fmmall.vo.RespResultVO;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

/**
 * @Description: 订单 ServiceImpl
 * @Author: gjzhao
 * @Date Created in 2022-02-08 7:57 下午
 */
@Service
public class OrderServiceImpl implements OrderService {

    private Logger logger = LoggerFactory.getLogger(getClass());

    /**
     * 添加订单
     *
     * @param cartIds
     * @param order
     * @return
     */
    @Override
    public RespResultVO addOrder(String cartIds, Orders order) {
        logger.info("-----order-add服务开始处理订单业务----");
        logger.info("-----购物车ids:{},提交的订单信息:{}----", cartIds, order);
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("cartIds", cartIds);
        map.put("orders", order);
        logger.info("-----order-add服务处理订单业务结束----");
        return RespResultVO.success(map);
    }

    /**
     * 获取订单信息
     *
     * @param orderId
     * @return
     */
    @Override
    public RespResultVO getOrder(String orderId) {
        logger.info("-----order-add服务开始查询订单业务----");
        Orders order = new Orders(orderId, "admin", new BigDecimal("100"), "1");
        return RespResultVO.success(order);
    }
}
